package qs.ipeControls
{
import mx.containers.Box;
import mx.controls.ColorPicker;
import mx.controls.Label;

import qs.ipeControls.classes.IPEBase;

[Event(name="change", type="mx.events.ColorPickerEvent")]
public class IPEColorPicker extends IPEBase
{
public function IPEColorPicker():void
{
super();
this.nonEditableControl = new Box()
this.editableControl = new ColorPicker();
facadeEvents(editableControl,"change");
}

override protected function commitEditedValue():void
{
    
   
    
}

private function get colorPicker():ColorPicker { return ColorPicker(this.editableControl); }
private function get label():Label { return Label(this.nonEditableControl); }

[Bindable("change")]
public function get text():String { return this.colorPicker.selectedColor as String; }
public function set text(text:String):void
{trace("set text")
    this.label.text = text;
    /* for(var i:int=0; i<(ArrayCollection(colorPicker.dataProvider).length)-1; i++)
    {
        var tmpObj:Object = ArrayCollection(colorPicker.dataProvider).getItemAt(i);
        if(tmpObj.label == text)
            this.colorPicker.selectedIndex = i;
    } */
}
public function get selectedColor():int { return this.colorPicker.selectedColor; }
public function set selectedColor(item:int):void { this.colorPicker.selectedColor = item; }
public function get selectedIndex():int { return this.colorPicker.selectedIndex; }
public function set selectedIndex(index:int):void
{
    this.colorPicker.selectedIndex = index;
    
}

//public function get labelField():String { return this.comboBox.labelField; }
//public function set labelField(labelField:String):void { this.comboBox.labelField = labelField; }



}

}